Why do I see MS jQuery samples use `$(domReady); `?
Posted
by Atomiton
on Stack Overflow
See other posts from Stack Overflow
or by Atomiton
Published on 2010-04-12T20:30:28Z
Indexed on
2010/04/12
20:33 UTC
Read the original article
Hit count: 276
I don't know if anyone ELSE has noticed this, but I noticed the jQuery samples I see on MS tend to use a different format:
<script type="text/javascript">
$( domReady );
function domReady() {
$('#btn').click( showMessage );
}
function showMessage() {
$('#message').fadeIn('slow');
}
</script>
Isn't this the same as:
$(document).ready( function() {
$('#btn').click( showMessage );
function showMessage() {
$('#message').fadeIn('slow');
}
});
Is there any advantage of using one syntax over the other?
I will admit, the MS way does look cleaner.
© Stack Overflow or respective owner